Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

298
Views
How to disable some of time value selection in html input tag type="time"?

I have an input as type="time" when user click to select a time, I would like to disable some of time stamps for example 8:30 and 10:30 be disabled and user be not able to choose them. Preferably with JavaScript or css if possible.

Any idea how to do it?

enter image description here

<form action="/action_page.php">
  <label for="appt">Select a time:</label>
  <input type="time" id="appt" name="appt">
  <input type="submit" value="Submit">
</form>

Edited:

After getting a suggestion with this link I decided to use <dataList> as below, when I disable the option they disappear from list what is unsuitable for my cass.

Any suggestion why it disappear instead of disabling?

<input type="time" id="appt" name="appt" list="time-list">

   <datalist id="time-list" >
        <option id="08" name="08"  value="08:30" datatype="time" disabled>
        <option id="09" name="09" value="09:30" datatype="time" >
        <option id="10" name="10" value="10:30" datatype="time">
        <option id="11" name="11" value="11:30" datatype="time" disabled>
        <option id="13" name="13" value="13:30" datatype="time" >
        <option id="20" name="20" value="20:30" datatype="time">
    </datalist>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!